package com.centsuse.my_redis.config;

import com.centsuse.my_redis.dao.CallerToken;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.stereotype.Component;
import java.lang.reflect.Method;

@Component("customKeyGenerator")
public class CustomKeyGenerator implements KeyGenerator {

    @Override
    public Object generate(Object target, Method method, Object... params) {
        CallerToken callerToken = (CallerToken) params[0];
        return callerToken.getCaller();
    }
}